class ScrollerHUD extends HUD;

var Texture CrossHair;

simulated event PostRender(Canvas C)
{
   Super.PostRender(C);

   ScrollerController(PlayerOwner).LastHUDSizeX = C.SizeX;
   ScrollerController(PlayerOwner).LastHUDSizeY = C.SizeY;

   DrawMouseCursor(C);

   return;
}


simulated function DrawMouseCursor(Canvas C)
{
   local float XPos, YPos;
   local vector MovingPawnCoords;
   local float theAngle;

   C.SetDrawColor(255, 255, 255);
   C.Style = ERenderStyle.STY_Alpha;

   // find position of cursor, and clamp it to screen
   XPos = ScrollerController(PlayerOwner).PlayerMouse.X + C.SizeX / 2.0;
   if (XPos < 0)
   {
      ScrollerController(PlayerOwner).PlayerMouse.X -= XPos;
      XPos = 0;
   }
   else if (XPos >= C.SizeX)
   {
      ScrollerController(PlayerOwner).PlayerMouse.X -= (XPos - C.SizeX);
      XPos = C.SizeX - 1;
   }
   YPos = ScrollerController(PlayerOwner).PlayerMouse.Y + C.SizeY / 2.0;
   if (YPos < 0)
   {
      ScrollerController(PlayerOwner).PlayerMouse.Y -= YPos;
      YPos = 0;
   }
   else if (YPos >= C.SizeY)
   {
      ScrollerController(PlayerOwner).PlayerMouse.Y -= (YPos - C.SizeY);
      YPos = C.SizeY - 1;
   }


   if(ScrollerController(self.PlayerOwner).MovingPawnController!=none)
   {
       MovingPawnCoords = C.WorldToScreen(ScrollerController(self.PlayerOwner).MovingPawnController.Pawn.Location+ScrollerController(self.PlayerOwner).MovingPawnController.Pawn.EyePosition());
       theAngle = aTan((XPos - MovingPawnCoords.X),(YPos-MovingPawnCoords.Y));
       ScrollerController(self.PlayerOwner).targetAngle = theAngle;
   }



   C.SetPos(XPos, YPos);
   C.DrawIcon(CrossHair,1);

   return;
}

defaultproperties
{
    CrossHair=Texture'Crosshairs.Crosshair_Circle1';
}
